var app = getApp()
Page({
  data: {
    banners: [],
    productList:[],
    loading: true
  },
  onLoad: function () {
    app.fetchApi("https://cake.cindata.cn/product/appQueryproductByType", (err, data) => {
      this.setData({ productList: data.productList, banners: data.banners, loading: false })
    })
  },
  gotoProduct: function(e) {
    if (e.currentTarget.dataset.id) {
      wx.navigateTo({
        url: '/pages/goods/goods?id=' + e.currentTarget.dataset.id
      })
    }
  }
})